let arr = [2, 1, 5, 2, 2, 5, 1, 4, 6, 8, 3, 4];

// set
let arr1 = new Set(arr);
let arr2 = [];
for (let a of arr1) {
   arr2.push(a);
}
console.log(arr2);

// 
let arr3 = arr.sort();
let arr4 = []
for (let i = 0; i < arr3.length; i++) {
   if (arr3[i] == arr3[i + 1]) {
      continue
   }
   arr4.push(arr3[i])
}
console.log(arr4);